/*
 * The contents of this file are subject to the Mozilla Public License
 * Version 1.1 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 * 
 * The Original Code is iSQL-Viewer, A Mutli-Platform Database Tool.
 *
 * The Initial Developer of the Original Code is iSQL-Viewer, A Mutli-Platform Database Tool.
 * Portions created by Mark A. Kobold are Copyright (C) 2000-2007. All Rights Reserved.
 *
 * Contributor(s): 
 *  Mark A. Kobold [mkobold <at> isqlviewer <dot> com].
 *  
 * If you didn't download this code from the following link, you should check
 * if you aren't using an obsolete version: http://www.isqlviewer.com
 */
package org.isqlviewer.model;

/**
 * Types of nodes that can be found within the JDBC Schema Tree.
 * <p>
 * Actually expirementing a new code style/pattern with enumerations where the type of node can actually define a
 * 'preferredIcon' so that the renderer is not required to be coded with icon information for rendering each node.
 * 
 * @author Mark A. Kobold &lt;mkobold at isqlviewer dot com&gt;
 * @version 1.0
 */
public enum SchemaNodeType {

    /**
     * Root node of the JDBC Schema tree this type here for completness and has no real value.
     */
    ROOT,
    /**
     * Non cached nodes are nodes that are likely to cause a lot of JDBC traffic nodes of these types serve to mark the
     * parent node to load the information at the user's request.
     */
    NON_CACHED("information"),
    /**
     * Table Type node that is usually of the form INDEX, TABLE, VIEW, SYNONYM, and etc.
     */
    TABLE_TYPE("table_set"),
    /**
     * Table node that is a a child of TABLE_TYPE, and represents a database table or view usually.
     */
    TABLE("table"),
    /**
     * Index information for a given table, this node is usually a child of a TABLE node.
     */
    INDEX("table_info"),
    /**
     * Node that shows that the current table has primary keys defined.
     */
    PRIMARY_KEYS("table_keys"),
    /**
     * Node that shows that other tables that rely on the primary keys defined within the table.
     */
    EXPORTED_KEYS("table_keys"),
    /**
     * Node that shows foriegn keys from other tables that part of the table's definition.
     */
    IMPORTED_KEYS("table_keys"),
    /**
     * If tables is defined in a hierarchial fashion then this node shows the parent tables for the current one.
     */
    SUPER_TABLES("table_info"),
    /**
     * Node to indicate that this table defines columns that are automatically updated when any row is updated.
     */
    VERSION_COLUMNS("table_info"),
    /**
     * Node for indicating that the table has defined security constraints on the table.
     */
    TABLE_PRIVILIGES("table_info"),
    /**
     * Node that indicates that the current table has column specific priviliges defined.
     */
    COLUMN_PRIVILIGES("table_info"),
    /**
     * This node type is a place holder for representing the parent column node for the actual column type.
     * <p>
     * The children for this node are loaded on demand by the user.
     */
    COLUMN_SET("table_columns"),
    /**
     * Node that represents a column in a table, the parent node type is acutually a COLUMN_SET.
     */
    COLUMN("table_info"),
    /**
     * This node type is a place holder as the parent node for stored procedure for the actual procedure type.
     */
    PROCEDURE_SET("procedure_set"),
    /**
     * Node that represents a stored procedure definied in the current catalog and or schema.
     * <p>
     * The children for this node are loaded on demand by the user.
     */
    PROCEDURE("procedure"),
    /**
     * This node type is a place holder as the parent node for data types that are allowed by the current database.
     * <p>
     * The childeren for this node are loaded on demand by the user.
     */
    DATA_TYPE_SET("data_type_set"),
    /**
     * Node the represents a data type defined by the current database.
     */
    DATA_TYPE("data_type"),
    /**
     * This node type is a place holder as the parent node for user data types that are defined in the current
     * catalog/schema.
     * <p>
     */
    UDT_SET("folder"),
    /**
     * This node type is a place holder as the parent node for user data types are DISTINCT types.
     * <p>
     */
    UDT_SET_DISTINCT("folder"),
    /**
     * This node type is a place holder as the parent node for user data types are JAVA_OBJECT types.
     * <p>
     */
    UDT_SET_JAVA_OBJECT("folder"),
    /**
     * This node type is a place holder as the parent node for user data types are STRUCT types.
     * <p>
     */
    UDT_SET_STRUCT("folder"),
    /**
     * A node that represents a user data type that is supported by the current schema/catalog.
     */
    UDT("data_type");

    private String preferredIcon = null;

    SchemaNodeType() {

        this(null);
    }

    SchemaNodeType(String preferredIcon) {

        this.preferredIcon = preferredIcon;
    }

    public String getPreferredIcon() {

        return preferredIcon;
    }
}